package com.ruoyi.oa.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.oa.mapper.OaApplyRecordMapper;
import com.ruoyi.oa.domain.OaApplyRecord;
import com.ruoyi.oa.service.IOaApplyRecordService;

/**
 * 用车记录Service业务层处理
 * 
 * @author allen
 * @date 2025-01-04
 */
@Service
public class OaApplyRecordServiceImpl implements IOaApplyRecordService 
{
    @Autowired
    private OaApplyRecordMapper oaApplyRecordMapper;

    /**
     * 查询用车记录
     * 
     * @param applyId 用车记录主键
     * @return 用车记录
     */
    @Override
    public OaApplyRecord selectOaApplyRecordByApplyId(Long applyId)
    {
        return oaApplyRecordMapper.selectOaApplyRecordByApplyId(applyId);
    }

    /**
     * 查询用车记录列表
     * 
     * @param oaApplyRecord 用车记录
     * @return 用车记录
     */
    @Override
    public List<OaApplyRecord> selectOaApplyRecordList(OaApplyRecord oaApplyRecord)
    {
        return oaApplyRecordMapper.selectOaApplyRecordList(oaApplyRecord);
    }

    /**
     * 新增用车记录
     * 
     * @param oaApplyRecord 用车记录
     * @return 结果
     */
    @Override
    public int insertOaApplyRecord(OaApplyRecord oaApplyRecord)
    {
        // 需要加逻辑
        // 获取当前用户id, 和当前的审批者id
        oaApplyRecord.setCreateTime(DateUtils.getNowDate());
        return oaApplyRecordMapper.insertOaApplyRecord(oaApplyRecord);
    }

    /**
     * 修改用车记录
     * 
     * @param oaApplyRecord 用车记录
     * @return 结果
     */
    @Override
    public int updateOaApplyRecord(OaApplyRecord oaApplyRecord)
    {
        oaApplyRecord.setUpdateTime(DateUtils.getNowDate());
        return oaApplyRecordMapper.updateOaApplyRecord(oaApplyRecord);
    }

    /**
     * 批量删除用车记录
     * 
     * @param applyIds 需要删除的用车记录主键
     * @return 结果
     */
    @Override
    public int deleteOaApplyRecordByApplyIds(Long[] applyIds)
    {
        return oaApplyRecordMapper.deleteOaApplyRecordByApplyIds(applyIds);
    }

    /**
     * 删除用车记录信息
     * 
     * @param applyId 用车记录主键
     * @return 结果
     */
    @Override
    public int deleteOaApplyRecordByApplyId(Long applyId)
    {
        return oaApplyRecordMapper.deleteOaApplyRecordByApplyId(applyId);
    }
}
